
package com.punch.common.feign;


import com.punch.common.constant.ServiceNameConstants;
import com.punch.common.dto.login.AppLoginUserDTO;
import com.punch.common.feign.fallback.FeignPlatformUserServiceFallbackFactory;
import com.punch.common.model.LoginUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;


/**
 * app端远程调用
 */
@FeignClient(name = ServiceNameConstants.USER_SERVICE, fallbackFactory = FeignPlatformUserServiceFallbackFactory.class, decode404 = true)
public interface FeignPlatformUserService {

    /**
     * 通过手机号查找手机用户信息
     *
     * @param mobile 手机号码
     * @return loginUser
     */
    @GetMapping(value = "/app-user/mobile", params = "mobile")
    LoginUser getUserByMobile(@RequestParam("mobile") String mobile);


    /**
     * 平台用户登录,不存在则注册
     *
     * @param appLoginUserDTO 平台用户表单
     */
    @PostMapping(value = "/app-user")
    void saveOrUpdatePlatformUser(@RequestBody AppLoginUserDTO appLoginUserDTO);


    /**
     * 平台用户忘记密码
     *
     * @param appLoginUserDTO 平台用户表单
     */
    @PostMapping(value = "/app-user/pwd-forget")
    Boolean forgetUserPwd(@RequestBody AppLoginUserDTO appLoginUserDTO);
}

